<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateReceivingTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('receiving', function (Blueprint $table) {
            $table->id();
            $table->char('code', 12)->unique()->comment('入库单号');
            $table->unsignedBigInteger('customer_id')->comment('客户ID');
            $table->char('district', 4)->comment('进境关别');
            $table->char('type', 1)->comment('进口类型: 0 一线入区 1 二线转关 2 库存调整');
            $table->double('weight', 19, 5)->comment('货物总毛重');
            $table->double('price', 19, 5)->comment('货物总价值');
            $table->char('transport', 1)->comment('运输方式');
            $table->char('packing', 1)->comment('包装类型');
            $table->integer('piece')->comment('件数');
            $table->integer('product_count')->comment('产品个数');
            $table->char('status', 1)->default(0)->comment('状态：0 草稿 1 待审核 2 已审核 3 驳回 4 到货 5 收货完成');
            $table->string('remark', 1000)->nullable()->comment("备注");
            $table->timestamps();
            $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('receiving');
    }
}
